xen: credit2: avoid cpumask_any() in pick_cpu().
authorDario Faggioli <dario.faggioli@citrix.com>
Fri, 7 Apr 2017 16:57:00 +0000 (18:57 +0200)
committerGeorge Dunlap <george.dunlap@citrix.com>
Fri, 7 Apr 2017 17:17:39 +0000 (18:17 +0100)
commit6348214c5d0b410d94073bbdab6915e84182641a
tree9e8b3ade381bcad5d28b781e071351e81b043a7d
parent46bab93935c0b3fa6d50482e76abc08f0ce4df3f
xen: credit2: avoid cpumask_any() in pick_cpu().

cpumask_any() is costly (because of the randomization).
And since it does not really matter which exact CPU is
selected within a runqueue, as that will be overridden
shortly after, in runq_tickle(), spending too much time
and achieving true randomization is pretty pointless.

As the picked CPU, however, would be used as an hint,
within runq_tickle(), don't give up on it entirely,
and let's make sure we don't always return the same
CPU, or favour lower or higher ID CPUs.

To achieve that, let's record and remember, for each
runqueue, what CPU we picked for last, and start from
that the following time.

Signed-off-by: Dario Faggioli <dario.faggioli@citrix.com>
Acked-by: George Dunlap <george.dunlap@citrix.com>
xen/common/sched_credit2.c